/*
 * SRMI (an easy-to-use zero-code remoting library for Java)
 * Copyright (C) 2007  Mohammad Nabil Hussein
 * mohammad (dot) nabil (dot) h (at) gmail (dot) com
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

package SRMI.Tests;

import java.io.Serializable;

public class MyServer extends MyServerParent implements Serializable
{
    public MyServer()
    {
        System.out.println("Evil <init> called");
    }
    
    public String cat(String F, String U)
    {
        System.out.println("request to cat " + F + " + " + U);
        return F + U;
    }
    
    private MyClient clnt;
    
    public void CallMe(MyClient clnt)
    {
        System.out.println("calling client");
        clnt.CallingYou();
        this.clnt = clnt;
    }
    
    public static void main(String[] args) throws Exception
    {
        System.out.println("Usage:\njava -Dsrmi.basedir=$(pwd) -Dsrmi.jar.path=../../dist/SRMI.jar -classpath .:../../dist/lib/tools.jar:../../../Orchestra/dist/lib/log4j-1.2.14.jar SRMI.Tests.MyServer");
 
        //java.lang.System.setProperty("srmi.basedir","/home/meemo/Desktop/RMI_W/build/classes");
        
        SRMI.RemotingServices.ServerUtils.DeclareObject(new MyServer());
    }

    public void CallMe(MyIndirectClient myIndirectClient)
    {   
        myIndirectClient.CallMe(clnt);
    }

    public MyClient GetMyClient()
    {
        return clnt;
    }
}